package com.buanalintas.sandals.pos.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "pos_transaction_request_detail")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosTransactionRequestDetail.findAll", query = "SELECT t FROM PosTransactionRequestDetail t"),
//    @NamedQuery(name = "PosTransactionRequestDetail.findBySync", query = "SELECT t FROM PosTransactionRequestDetail t WHERE t.sync = :sync"),
//    @NamedQuery(name = "PosTransactionRequestDetail.findByRequestDetailId", query = "SELECT t FROM PosTransactionRequestDetail t WHERE t.requestDetailId = :requestDetailId"),
//    @NamedQuery(name = "PosTransactionRequestDetail.findByRequestDetailQuantity", query = "SELECT t FROM PosTransactionRequestDetail t WHERE t.requestDetailQuantity = :requestDetailQuantity"),
//    @NamedQuery(name = "PosTransactionRequestDetail.findByRequestDetailEstimatedPrice", query = "SELECT t FROM PosTransactionRequestDetail t WHERE t.requestDetailEstimatedPrice = :requestDetailEstimatedPrice")})
public class PosTransactionRequestDetail implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "request_detail_id")
    private Integer requestDetailId;
    @Basic(optional = false)
    @Column(name = "request_detail_quantity")
    private Integer requestDetailQuantity;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
//    @Basic(optional = false)
//    @Column(name = "request_detail_estimated_price")
//    private BigDecimal requestDetailEstimatedPrice;
    @Basic(optional = false)
    @Lob
    @Column(name = "request_detail_description")
    private String requestDetailDescription;
    @Column(name = "request_detail_size")
    private String requestDetailSize;
    @JoinColumn(name = "request_detail_item_id", referencedColumnName = "item_id")
    @ManyToOne(optional = false)
    private PosMasterItem requestDetailItemId;
    @JoinColumn(name = "request_detail_request_id", referencedColumnName = "request_id")
    @ManyToOne(optional = false)
    private PosTransactionRequest requestDetailRequestId;
    @JoinColumn(name = "request_detail_size_id", referencedColumnName = "size_id")
    @ManyToOne(optional = false)
    private PosMasterSize requestDetailSizeId;

    public PosTransactionRequestDetail() {
    }

    public PosTransactionRequestDetail(Integer requestDetailId) {
        this.requestDetailId = requestDetailId;
    }

    public PosTransactionRequestDetail(Integer requestDetailId, Integer requestDetailQuantity, BigDecimal requestDetailEstimatedPrice, String requestDetailDescription) {
        this.requestDetailId = requestDetailId;
        this.requestDetailQuantity = requestDetailQuantity;
//        this.requestDetailEstimatedPrice = requestDetailEstimatedPrice;
        this.requestDetailDescription = requestDetailDescription;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getRequestDetailId() {
        return requestDetailId;
    }

    public void setRequestDetailId(Integer requestDetailId) {
        this.requestDetailId = requestDetailId;
    }

    public PosMasterItem getRequestDetailItemId() {
        return requestDetailItemId;
    }

    public void setRequestDetailItemId(PosMasterItem requestDetailItemId) {
        this.requestDetailItemId = requestDetailItemId;
    }

    public Integer getRequestDetailQuantity() {
        return requestDetailQuantity;
    }

    public void setRequestDetailQuantity(Integer requestDetailQuantity) {
        this.requestDetailQuantity = requestDetailQuantity;
    }

//    public BigDecimal getRequestDetailEstimatedPrice() {
//        return requestDetailEstimatedPrice;
//    }
//
//    public void setRequestDetailEstimatedPrice(BigDecimal requestDetailEstimatedPrice) {
//        this.requestDetailEstimatedPrice = requestDetailEstimatedPrice;
//    }

    public String getRequestDetailDescription() {
        return requestDetailDescription;
    }

    public void setRequestDetailDescription(String requestDetailDescription) {
        this.requestDetailDescription = requestDetailDescription;
    }

    public PosTransactionRequest getRequestDetailRequestId() {
        return requestDetailRequestId;
    }

    public void setRequestDetailRequestId(PosTransactionRequest requestDetailRequestId) {
        this.requestDetailRequestId = requestDetailRequestId;
    }

    public String getRequestDetailSize() {
        return requestDetailSize;
    }

    public void setRequestDetailSize(String requestDetailSize) {
        this.requestDetailSize = requestDetailSize;
    }

    public PosMasterSize getRequestDetailSizeId() {
        return requestDetailSizeId;
    }

    public void setRequestDetailSizeId(PosMasterSize requestDetailSizeId) {
        this.requestDetailSizeId = requestDetailSizeId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (requestDetailId != null ? requestDetailId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionRequestDetail)) {
            return false;
        }
        PosTransactionRequestDetail other = (PosTransactionRequestDetail) object;
        if ((this.requestDetailId == null && other.requestDetailId != null) || (this.requestDetailId != null && !this.requestDetailId.equals(other.requestDetailId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
//        return requestDetailId;
        return "com.buanalintas.sandals.pos.entities.PosTransactionRequestDetail[ requestDetailId=" + requestDetailId + " ]";
    }
}